<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <title>Spring Thyme Seed Starter Manager</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body >
<p th:text="${today}">13 February 2011</p>

<h3>内置对象</h3>
Established locale country: <span th:text="${#locale.country}">US</span>.

<hr/>
<h3>工具对象</h3>
<h4>date</h4>
Today is: <span th:text="${#calendars.format(today2,'dd MMMM yyyy')}">13 May 2011</span>
<br/>
Today is: <span th:text="${#dates.format(today2,'dd MMMM yyyy')}">13 May 2011</span>
<br/>
Today is: <span th:text="${#dates.format(today2)}">13 May 2011</span><br/>
<h4>uris</h4>
<p th:text="${#numbers.formatDecimal(20.12,3,10)}">asdasd</p>
<h6>formatDecimal(20.12,3,10) 参数1 要格式化的数字，参数2 保留整数位数，参数3 保留小数位数</h6>
<h4>strings</h4>
<p th:text="${#strings.append('ab','c')}"></p>
<p th:text="${#strings.arrayToUpperCase(stringArray)[1]}">B</p>
<h4>objects</h4>
<p th:text="${#objects.nullSafe(21,1)}"></p>
<p th:text="${#objects.arrayNullSafe(stringArray,'')[0]}"></p>
<h4 style="color: brown">lists</h4>
<p th:text="${#lists.sort(list)}"></p>
<hr/>
<h3> Link URLs</h3>
<a href="#" th:href="@{/hello1}">链接hello1</a>
<a href="#" th:href="@{/hello1(param=${stringArray[0]})}">链接hello1 传参数</a>
<a th:href="@{'hello1/'+${stringArray[0]}(orderId=${stringArray[0]})}">拼接的URL</a>

<h4>th:text 中数字运算</h4>
<div th:text="3+2">...</div>
<div th:text="1/6">...</div>
<span th:text="'The age of the user is ' + ${age}"></span>
<span th:text="|Welcome to our application, ${age}!|"></span>
<div th:with="isEven=(${age} % 2 == 0)">2222</div>

<h4>Boolean </h4>
<p th:text="${isMarry}"></p>
<p th:if="${age > 29}">adasdas</p>
<h4> tokens</h4>
<div th:class="${age}">...</div>


<div th:object="${user}">
    <p>Age: <span th:text="*{age ==0}? '(no age specified)' : *{age}">27</span>.</p>
</div>

<span th:text="${user.name == Exception} ?: 'no user authenticated'">...</span>
<hr/>
<h3>each</h3>
<ul th:each="st,st2 : ${stringArray}">
    <li th:text="${st}"></li>
    <li th:text="${st2}"></li>
</ul>
</body>
</html>